#include "simple_string.h"
#include "simple_string_owner.h"
#include <iostream>

void ownAString() {
  SimpleString a{50};
  a.appendLine("Hello, ");
  a.appendLine("world!");
  SimpleStringOwner b{a};
}

void refType(int &x) { printf("lvalue reference %d\n", x); }

void refType(int &&x) { printf("rvalue reference %d\n", x); }

void useRefType() {
  auto x = 1;
  refType(x);
  refType(2);
  refType(x + 3);
}

void useRefType2() {
  auto x = 1;
  refType(std::move(x));
  refType(2);
  refType(x + 3);
}

int main(int argc, char *argv[]) {
  std::cout << "==== ch04 p06 ====" << std::endl;
  printf("---- useRefType ----\n");
  useRefType();
  printf("---- useRefType2 ----\n");
  useRefType2();
  return 0;
}
